Skip to content

Core: stop serializing deprecated schema last column id#16927

Open
minleejae wants to merge 1 commit into
apache:mainfrom
minleejae:fix-add-schema-last-column-id
Open

Core: stop serializing deprecated schema last column id#16927
minleejae wants to merge 1 commit into
apache:mainfrom
minleejae:fix-add-schema-last-column-id

Conversation

@minleejae

@minleejae minleejae commented Jun 22, 2026

Copy link
Copy Markdown

Why

AddSchemaUpdate.last-column-id is deprecated and optional in the REST OpenAPI spec. Java already ignores this field when parsing add-schema updates and computes the table-level last column ID internally.

However, Java still serializes the deprecated field using schema.highestFieldId(). After dropping the column with the highest field ID, this value can decrease even though table metadata last-column-id must not decrease. REST catalog implementations that validate the deprecated request field can reject otherwise valid schema evolution updates, as reported in #13850.

This does not remove table metadata last-column-id; it only stops sending the deprecated optional field in AddSchemaUpdate. Field-id conflict validation is still carried by AssertLastAssignedFieldId requirements.

Compatibility notes

Catalogs that still send the deprecated field remain supported because parsing is unchanged. The omission path is part of the REST contract; server implementations that need the table-level last assigned field ID should use existing table metadata and/or AssertLastAssignedFieldId requirements rather than depending on the deprecated AddSchemaUpdate field.

What changed

  • Stop serializing deprecated last-column-id for add-schema metadata updates.
  • Keep parsing legacy payloads that still include last-column-id.
  • Add request serialization coverage for an add-schema update representing the schema after dropping the highest field ID.

Testing

  • JAVA_HOME=$(/usr/libexec/java_home -v 21) ./gradlew :iceberg-core:test --tests org.apache.iceberg.TestMetadataUpdateParser --tests org.apache.iceberg.rest.requests.TestUpdateTableRequestParser --tests org.apache.iceberg.rest.TestCatalogHandlers --console=plain --warning-mode=none
  • JAVA_HOME=$(/usr/libexec/java_home -v 21) ./gradlew :iceberg-core:spotlessJavaCheck --console=plain --warning-mode=none

@github-actions github-actions Bot added the core label Jun 22, 2026
@minleejae minleejae force-pushed the fix-add-schema-last-column-id branch from dbfc716 to 5f1536b Compare June 22, 2026 10:34
@minleejae

Copy link
Copy Markdown
Author

Hi @Fokko, could you take a look when you have a chance?

I think this is a follow-up to #11514 and #13850. The original direction was to stop exposing AddSchemaUpdate.last-column-id, but the Java serializer still sends the
deprecated optional field using schema.highestFieldId(). That can be incorrect after dropping the column with the highest field ID.

I added a REST server apply-path test to verify that omitting the field preserves the table-level last-column-id.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant